﻿
using Sustainalytics.Entities;
using System.Collections.Generic;
using Sustainalytics.Claims;
using System.Security.Claims;
using Xunit;

namespace Sustainalytics.ClaimsService.Tests
{
    public class Level2CacheTest
    {
        private IOperationClaimsRetriever _l2cache;

        public Level2CacheTest(IOperationClaimsRetriever l2cache)
        {
            _l2cache = l2cache;
        }

        [Fact]
        public void GetUserClaims()
        {
            List<Claim> receivedClaims = (List<Claim>)_l2cache.GetUserClaims(new Account() { Name = "Sustainalytics", Id = new System.Guid("596d5f79-9748-e411-9e5f-d89d67630ddc") });
            Assert.Equal(5, receivedClaims.Count);

            List<Claim> receivedClaims2 = (List<Claim>)_l2cache.GetUserClaims(new Account() { Name = "Sustainalytics Toronto", Id = new System.Guid("528ea769-2d17-e411-92ce-6c3be5be9f98") });
            Assert.Equal(11, receivedClaims2.Count);
        }

        [Fact]
        public void GetAllResourceMaps()
        {
            List<ResourceMap> resourceMaps = (List<ResourceMap>)_l2cache.GetAllResourceMaps();

            Assert.Equal(9, resourceMaps.Count);
        }
    }
}
